//创建线程方法一：继承Thread类，重写Run()方法，调用start开启线程
public class TestThread1 extends Thread {
    private String threadName;

    public TestThread1(String threadName) {
        this.threadName = threadName;
    }

    public void run() {
        //线程体
        for (int i = 0; i < 20; i++) {
            System.out.println(threadName + i);
        }
    }

    public static void main(String[] args) {

        //创建线程对象一
        TestThread1 testThread11 = new TestThread1("我是线程一");
        //调用Start方法开启线程
        testThread11.start();
        //创建线程对象二
        TestThread1 testThread12 = new TestThread1("我是线程二");
        //调用Start方法开启线程
        testThread12.start();

    }
}
